package com.liruo.learn.spring.mvc.controller.mvc;

import com.liruo.learn.spring.mvc.model.RequestBodyModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;

/**
 * @Author:liruo
 * @Date:2023-02-19-17:31:30
 * @Desc
 */
@RestController
@RequestMapping("/requestdatatype")
@Slf4j
public class RequestDataTypeController {
    @PostMapping("/urlencoded")
    public void urlencoded(RequestBodyModel requestBodyModel){
        log.info("{}", requestBodyModel);
    }
    @PostMapping("/formdata")
    public void formdata(RequestBodyModel requestBodyModel){
        log.info("{}", requestBodyModel);
    }
    @PostMapping("/json")
    public void json(@RequestBody RequestBodyModel requestBodyModel){
        log.info("{}", requestBodyModel);
    }
    @PostMapping("/query")
    public void query(RequestBodyModel requestBodyModel, String[] age){
        log.info("{} {}", Arrays.toString(age),  requestBodyModel);
    }
}
